<template>
  <div class="app-container task">
    <el-form v-show="showSearch" ref="queryForm" :model="queryParams" :inline="true">
      <el-form-item label="任务名称" prop="title">
        <el-input
          v-model="queryParams.title"
          placeholder="请输入任务名称"
          clearable
          size="small"
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="项目名称" prop="itemName">
        <el-input
          v-model="queryParams.itemName"
          placeholder="请输入项目名称"
          clearable
          size="small"
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>

      <el-form-item label="负责人" prop="cName" class="treeselect-form">
        <treeselect
          v-model="queryParams.cName"
          :options="userOptions"
          :disable-branch-nodes="true"
          :clearable="true"
          value-format="object"
          placeholder="请选择负责人"
          style="width: 240px"
        />
      </el-form-item>

      <el-form-item label="状态" prop="state">
        <el-select v-model="queryParams.state" multiple collapse-tags clearable placeholder="请选择任务状态">
          <el-option
            v-for="item in dict.type.task_status_type"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </el-form-item>

      <el-form-item label="优先级" prop="priority">
        <el-select v-model="queryParams.priority" clearable placeholder="请选择任务优先级">
          <el-option
            v-for="item in dict.type.work_level_type"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          v-hasPermi="['work:task:add']"
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
        >新增</el-button>
      </el-col>

      <el-col :span="1.5">
        <el-button
          v-hasPermi="['work:task:remove']"
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
        >删除</el-button>
      </el-col>

      <el-col :span="1.5">
        <el-button
          v-hasPermi="['work:task:export']"
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
        >导出</el-button>
      </el-col>
      <right-toolbar :show-search.sync="showSearch" @queryTable="getList" />
    </el-row>

    <el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" fixed="left" />

      <el-table-column label="任务名称" prop="title" align="center" show-overflow-tooltip min-width="200">
        <template slot-scope="scope">
          <span class="tableProjectName" @click="openTaskPlanDetail(scope.row)">{{ scope.row.title }}</span>
        </template>
      </el-table-column>

      <el-table-column label="负责人" prop="cName" show-overflow-tooltip min-width="200" />

      <el-table-column label="创建人" prop="creater" align="center" min-width="100" />

      <el-table-column label="状态" prop="outPlace" align="center" min-width="100">
        <template slot-scope="scope">
          <span v-if="scope.row.state === '0'" style="color: rgb(254, 115, 0); font-weight: bold;">{{ typeFormat('task_status_type', scope.row.state) }}</span>
          <span v-if="scope.row.state === '1'" style="color: rgb(74, 144, 226); font-weight: bold;">{{ typeFormat('task_status_type', scope.row.state) }}</span>
          <span v-if="scope.row.state === '2'" style="color: #82848a; font-weight: bold;">{{ typeFormat('task_status_type', scope.row.state) }}</span>
          <span v-if="scope.row.state === '3'" style="color: #00bd54; font-weight: bold;">{{ typeFormat('task_status_type', scope.row.state) }}</span>
          <span v-if="scope.row.state === '4'" style="color: #ff3030; font-weight: bold;">{{ typeFormat('task_status_type', scope.row.state) }}</span>
        </template>
      </el-table-column>

      <el-table-column label="所属项目" prop="itemName" align="center" min-width="180">
        <template slot-scope="scope">
          <span>{{ scope.row.itemName }}</span>
        </template>
      </el-table-column>

      <el-table-column label="开始时间" prop="startTime" align="center" min-width="150" />

      <el-table-column label="结束时间" prop="endTime" align="center" min-width="150" />

      <el-table-column label="优先级" prop="priority" align="center" min-width="120">
        <template slot-scope="scope">
          <div style="display: flex; justify-content: left; align-items: center;">
            <svg-icon v-if="scope.row.priority === '0'" icon-class="taskGrade1" font-size="25px" />
            <svg-icon v-if="scope.row.priority === '1'" icon-class="taskGrade2" font-size="25px" />
            <svg-icon v-if="scope.row.priority === '2'" icon-class="taskGrade3" font-size="25px" />
            <svg-icon v-if="scope.row.priority === '3'" icon-class="taskGrade4" font-size="25px" />
            <svg-icon v-if="scope.row.priority === '4'" icon-class="taskGrade5" font-size="25px" />
            <span style="margin-left: 5px;">{{ typeFormat('work_level_type', scope.row.priority) }}</span>
          </div>
        </template>
      </el-table-column>

      <el-table-column label="标签" prop="labels" align="center" min-width="180" />

      <el-table-column label="备注" prop="remarks" min-width="180">
        <template slot-scope="scope">
          <div class="tableRemarks" v-html="scope.row.remarks" />
        </template>
      </el-table-column>

      <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            v-if="scope.row.state === '0'"
            v-hasPermi="['work:task:start']"
            size="mini"
            type="text"
            icon="el-icon-check"
            @click="openEditState(scope.row, '1')"
          >开始</el-button>
          <el-button
            v-if="scope.row.state === '0'"
            v-hasPermi="['work:task:reject']"
            size="mini"
            type="text"
            icon="el-icon-close"
            @click="openEditState(scope.row, '4')"
          >拒绝</el-button>
          <el-button
            v-if="scope.row.state === '1'"
            v-hasPermi="['work:task:finish']"
            size="mini"
            type="text"
            icon="el-icon-finished"
            @click="openEditState(scope.row, '2')"
          >完成</el-button>
          <el-button
            v-if="scope.row.state === '2'"
            v-hasPermi="['work:task:check']"
            size="mini"
            type="text"
            icon="el-icon-user"
            @click="openEditState(scope.row, '3')"
          >验收</el-button>

          <el-dropdown
            size="mini"
            @command="(command) => handleCommand(command, scope.row)"
          >
            <span class="el-dropdown-link">
              <i class="el-icon-d-arrow-right el-icon--right" />更多
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item
                v-hasPermi="['work:task:query']"
                size="mini"
                type="text"
                icon="el-icon-view"
                command="openTaskDetail"
              >查看</el-dropdown-item>
              <el-dropdown-item
                v-if="scope.row.state !== '4'"
                v-hasPermi="['work:task:edit']"
                size="mini"
                type="text"
                icon="el-icon-edit"
                command="handleUpdate"
              >修改</el-dropdown-item>
              <el-dropdown-item
                v-hasPermi="['work:task:remove']"
                size="mini"
                type="text"
                icon="el-icon-delete"
                command="handleDelete"
              >删除</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改对话框 -->
    <el-dialog :title="title" :before-close="cancel" :visible.sync="open" :close-on-click-modal="false" width="900px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-row :gutter="20">
          <el-col :span="16">
            <el-row :gutter="10">
              <el-col :span="24">
                <el-form-item label="标题" prop="title">
                  <el-input v-model="form.title" type="input" placeholder="请输入标题" />
                </el-form-item>
              </el-col>
            </el-row>

            <el-row :gutter="10">
              <el-col :span="24">
                <el-form-item label="负责人" prop="cperson">
                  <treeselect
                    v-model="form.cperson"
                    :disabled="form.state === '2' || form.state === '3'"
                    :options="userOptions"
                    value-consists-of="LEAF_PRIORITY"
                    :multiple="true"
                    :clearable="true"
                    placeholder="请选择负责人"
                    @input="outerChanges"
                  />
                </el-form-item>
              </el-col>
            </el-row>

            <el-row :gutter="10">
              <el-col :span="12">
                <el-form-item label="任务类型" prop="type">
                  <el-select v-model="form.type" :disabled="form.state === '2' || form.state === '3'" placeholder="请选择任务类型">
                    <el-option
                      v-for="item in dict.type.work_todo_type"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="关联项目" prop="itemId">
                  <el-tooltip slot="label" class="item" effect="dark" content="只能关联“已创建 / 已分配”的项目" placement="top">
                    <i class="el-icon-info">关联项目</i>
                  </el-tooltip>

                  <el-select
                    v-model="form.itemId"
                    :disabled="form.state === '1' || form.state === '2' || form.state === '3'"
                    filterable
                    remote
                    reserve-keyword
                    placeholder="请选择关联项目"
                    :remote-method="projectRemoteMethod"
                    :loading="projectLoading"
                  >
                    <el-option
                      v-for="item in projectOptions"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>

            <el-row :gutter="10">
              <el-col :span="24">
                <el-form-item label="计划时间" prop="addDateRange">
                  <el-date-picker
                    v-model="addDateRange"
                    :disabled="form.state === '2' || form.state === '3'"
                    value-format="yyyy-MM-dd"
                    type="daterange"
                    :picker-options="pickerOptions"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    align="right"
                  />
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>

          <el-col :span="8">
            <el-row :gutter="20">
              <el-col :span="24">
                <el-form-item label="优先级" prop="priority">
                  <el-select v-model="form.priority" clearable placeholder="请选择任务优先级">
                    <el-option
                      v-for="item in dict.type.work_level_type"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>

              <el-col :span="24">
                <el-form-item label="标签" prop="labels">
                  <el-select v-model="form.labels" multiple clearable placeholder="请选择任务标签">
                    <el-option
                      v-for="item in dict.type.work_type_label"
                      :key="item.value"
                      :label="item.label"
                      :value="item.label"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
        </el-row>

        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item label="描述" prop="remarks">
              <editor v-model="form.remarks" upload-url="/oa/file/uploadFile" :min-height="192" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 任务详情 -->
    <el-dialog title="任务详情" width="500px" :visible.sync="taskDetailVisible">
      <el-steps :active="Number(taskDetail.state)" align-center direction="vertical" process-status="finish" finish-status="success">
        <el-step title="待办中">
          <div slot="description" class="taskDesc">
            <p>{{ taskDetail.creater + '于' + taskDetail.creatime + '创建' }}</p>
          </div>
        </el-step>

        <el-step v-if="taskDetail.state !== '4'" title="进行中">
          <div slot="description" class="taskDesc">
            <p v-if="taskDetail.state === '1' || taskDetail.state === '2' || taskDetail.state === '3'">{{ '操作人：' + stateList[0].creater + '；时间：' + stateList[0].stateTime + '；备注：' + stateList[0].remarks + '；' }}</p>
          </div>
        </el-step>

        <el-step v-if="taskDetail.state !== '4'" title="已完成">
          <div slot="description" class="taskDesc">
            <p v-if="taskDetail.state === '2' || taskDetail.state === '3'">{{ '操作人：' + stateList[0].creater + '；时间：' + stateList[1].stateTime + '；备注：' + stateList[1].remarks + '；' }}</p>
          </div>
        </el-step>

        <el-step v-if="taskDetail.state !== '4'" title="已验收">
          <div slot="description" class="taskDesc">
            <p v-if="taskDetail.state === '3'">{{ '操作人：' + stateList[0].creater + '；时间：' + stateList[2].stateTime + '；备注：' + stateList[2].remarks + '；' }}</p>
          </div>
        </el-step>

        <el-step v-if="taskDetail.state === '4'" title="已拒绝">
          <div slot="description" class="taskDesc">
            <p>{{ '操作人：' + stateList[0].creater + '；时间：' + stateList[0].stateTime + '；备注：' + stateList[0].remarks + '；' }}</p>
          </div>
        </el-step>
      </el-steps>
    </el-dialog>

    <!-- 修改任务状态 -->
    <el-dialog :title="editStateForm.title" width="400px" :before-close="cancel" :visible.sync="editStateVisible">
      <el-form ref="editStateForm" :model="editStateForm" :rules="editStateRules">
        <el-form-item label="备注" prop="remarks">
          <el-input v-model="editStateForm.remarks" placeholder="请填写意见、建议或总结" type="textarea" autocomplete="off" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="editState">确 定</el-button>
      </div>
    </el-dialog>

    <el-drawer
      title="关联计划"
      :visible.sync="taskPlanDetailVisible"
      direction="rtl"
      size="50%"
    >
      <el-table :data="taskPlanData" border>
        <el-table-column property="plan_detail" label="计划内容" show-overflow-tooltip min-width="250" />
        <el-table-column property="plan_date" label="计划日期" min-width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.plan_date) }}</span>
          </template>
        </el-table-column>
        <el-table-column property="completeTime" label="完成时间" min-width="180">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.completeTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column property="upload_name" label="责任人" min-width="100" />
        <el-table-column property="state" label="状态" min-width="100">
          <template slot-scope="scope">
            <span>{{ scope.row.state === '1' ? '已完成' : '未完成' }}</span>
          </template>
        </el-table-column>
      </el-table>
    </el-drawer>
  </div>
</template>

<script>
import { listTask, userDeptTree, getTaskDetail, getTaskPlan, deleteTask, addTask, updateTask, editTaskState, taskStateList } from '@/api/work/task'
import { listItem } from '@/api/work/project'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'

export default {
  name: 'WorkTripSummary',

  components: { Treeselect },

  dicts: ['task_status_type', 'work_todo_type', 'work_type_label', 'work_level_type'],

  data() {
    return {
      // 遮罩层
      loading: true,
      // 关联项目搜索loading
      projectLoading: false,
      // 任务详情dialog
      taskDetailVisible: false,
      // 任务计划详情dialog
      taskPlanDetailVisible: false,
      // 修改任务状态dialog
      editStateVisible: false,
      // 关联项目
      projectOptions: [],
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 表格数据
      planList: [],
      // 用户树形数据
      userOptions: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      // 查询日期范围
      dateRange: null,
      // 新增修改日期范围
      addDateRange: null,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10
      },
      // 表单参数
      form: {},
      // r任务详情
      taskDetail: {},
      // 任务状态列表
      stateList: [],
      // 任务计划列表
      taskPlanData: [],
      // 修改任务状态表单
      editStateForm: {},
      pickerOptions: {
        shortcuts: [{
          text: '1天',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            end.setTime(start.getTime() + 3600 * 1000 * 24 * 1)
            picker.$emit('pick', [start, end])
          }
        }, {
          text: '3天',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            end.setTime(start.getTime() + 3600 * 1000 * 24 * 3)
            picker.$emit('pick', [start, end])
          }
        }, {
          text: '一周',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            end.setTime(start.getTime() + 3600 * 1000 * 24 * 7)
            picker.$emit('pick', [start, end])
          }
        }],
        disabledDate(date) {
          return date.getTime() < new Date().getTime() - 24 * 60 * 60 * 1000
        }
      },
      // 表单校验
      rules: {
        title: [
          { required: true, message: '请输入任务标题', trigger: 'blur' }
        ],
        type: [
          { required: true, message: '请选择任务类型', trigger: 'change' }
        ],
        cperson: [
          { required: true, message: '请选择负责人', trigger: 'change' }
        ]
      },
      editStateRules: {
        remarks: [
          { required: true, message: '请填写意见、建议或总结', trigger: 'blur' }
        ]
      }
    }
  },

  created() {
    this.getList()
    this.userDeptTree()
  },

  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true
      const params = {
        ...this.queryParams,
        cName: this.queryParams.cName && this.queryParams.cName.label,
        state: this.queryParams.state && this.queryParams.state.join(',')
      }
      console.log('查询列表参数', params)
      listTask(params).then(response => {
        this.planList = response.rows
        this.total = response.total
        this.loading = false
      })
    },

    // 字典翻译
    typeFormat(type, state) {
      return this.selectDictLabel(this.dict.type[type], state)
    },

    /** 查询部门人员下拉树结构 */
    userDeptTree() {
      userDeptTree().then(response => {
        this.userOptions = this.diGuiTreeEdit(response.data)
      })
    },

    // 远程搜索关联项目
    projectRemoteMethod(query) {
      if (query) {
        this.projectLoading = true
        listItem({ itemName: query }).then(res => {
          this.projectOptions = res.rows.filter(val => {
            return val.status === '0' || val.status === '1'
          }).map(val => {
            return {
              label: val.itemName,
              value: val.id
            }
          })
          this.projectLoading = false
        })
      } else {
        this.projectOptions = []
      }
    },

    // 禁用最后一级非人员节点
    diGuiTreeEdit(item) {
      const data = item
      const treeAry = []
      for (const i in data) {
        const val = data[i]
        const node = {}
        if (val) {
          if (val.children && val.children.length > 0) {
            node.id = val.id
            node.label = val.label
            node.children = this.diGuiTreeEdit(val.children)
            treeAry.push(node)
          } else {
            if (val.type === '0') {
              node.isDisabled = true
            } else {
              node.isDisabled = false
            }
            node.id = val.id
            node.label = val.label
            treeAry.push(node)
          }
        }
      }
      return treeAry
    },

    // 取消按钮
    cancel() {
      this.open = false
      this.editStateVisible = false
      this.reset()
    },

    // 表单重置
    reset() {
      this.form = {
        title: undefined,
        cperson: undefined,
        type: undefined,
        itemId: undefined,
        priority: undefined,
        labels: undefined,
        remarks: undefined,
        starttime: undefined,
        endtime: undefined
      }
      this.addDateRange = null
      this.resetForm('form')
      this.resetForm('editStateForm')
    },

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },

    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = null
      this.resetForm('queryForm')
      this.handleQuery()
    },

    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection // .map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },

    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = '添加任务'
    },

    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      getTaskDetail(row.id).then(response => {
        this.form = {
          ...response.data,
          cperson: response.data.cperson.split(',').map(Number),
          labels: response.data.labels && response.data.labels.split(',')
        }
        this.projectRemoteMethod(response.data.itemName)
        this.addDateRange = response.data.startTime && [response.data.startTime, response.data.endTime]
        this.open = true
        this.title = '修改任务'
      })
    },

    /** 提交按钮 */
    submitForm: function() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          if (this.title === '修改任务') {
            const params = {
              ...this.form,
              startTime: this.addDateRange && this.addDateRange[0],
              endTime: this.addDateRange && this.addDateRange[1],
              cperson: this.form.cperson.join(','),
              labels: this.form.labels && this.form.labels.join(',')
            }
            console.log('修改params', params)
            updateTask(params).then(response => {
              this.$modal.msgSuccess('修改成功')
              this.cancel()
              this.getList()
            })
          } else {
            const params = {
              ...this.form,
              state: 0,
              startTime: this.addDateRange && this.addDateRange[0],
              endTime: this.addDateRange && this.addDateRange[1],
              cperson: this.form.cperson.join(','),
              labels: this.form.labels && this.form.labels.join(',')
            }
            console.log('新增params', params)
            addTask(params).then(response => {
              this.$modal.msgSuccess('新增成功')
              this.cancel()
              this.getList()
            })
          }
        }
      })
    },

    /** 删除按钮操作 */
    handleDelete(row) {
      const roleIds = row.id || this.ids.map(item => item.id)
      const msg = row.title || this.ids.map(item => item.title)
      this.$modal.confirm('是否确认删除名称为"' + msg + '"的任务？').then(function() {
        return deleteTask(roleIds)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess('删除成功')
      }).catch(() => {})
    },

    // 新增、修改出差人员变动监听
    outerChanges() {
      this.$refs['form'].validateField('cperson')
    },

    /** 导出按钮操作 */
    handleExport() {
      this.download('oa/dispath/export', {
        ...this.queryParams
      }, `任务列表_${new Date().getTime()}.xlsx`, 'get', 'local')
    },

    // 打开任务详情弹窗
    openTaskDetail(row) {
      taskStateList({ dispatchId: row.id }).then(res => {
        console.log('任务状态列表', res)
        this.taskDetail = row
        this.stateList = res.rows
        this.taskDetailVisible = true
      })
    },

    // 打开任务关联的计划列表弹窗
    openTaskPlanDetail(row) {
      getTaskPlan(row.id).then(res => {
        console.log('任务计划列表', res)
        this.taskPlanData = res.data
        this.taskPlanDetailVisible = true
      })
    },

    openEditState(row, state) {
      this.editStateForm = {
        title: state === '1' ? '开始任务' : state === '2' ? '完成任务' : state === '3' ? '验收任务' : state === '4' ? '拒绝任务' : '',
        dispatchId: row.id,
        dispathState: state,
        remarks: ''
      }
      this.reset()
      this.editStateVisible = true
    },

    editState() {
      this.$refs['editStateForm'].validate(valid => {
        if (valid) {
          editTaskState(this.editStateForm).then(res => {
            console.log('修改任务状态', res)
            this.$modal.msgSuccess('操作成功！')
            this.editStateVisible = false
            this.getList()
          })
        }
      })
    },

    // 更多操作触发
    handleCommand(command, row) {
      console.log('更多操作触发')
      switch (command) {
        case 'openTaskDetail':
          this.openTaskDetail(row)
          break
        case 'handleUpdate':
          this.handleUpdate(row)
          break
        case 'handleDelete':
          this.handleDelete(row)
          break
        default:
          break
      }
    }

  }
}
</script>

<style lang="scss" scoped>
.task{
  .tableRemarks {
    max-width: 100px;
    max-height: 100px;

    ::v-deep p {
      margin: 0;
    }
  }

  .tableProjectName {
    color: #46a6ff;
    cursor: pointer;

    &:hover {
      color: hsl(209, 100%, 50%);
    }
  }
}

.el-date-editor {
  width: 100%;
}

.taskDesc {
  min-height: 50px;
}
</style>
